package com.asa.numanaly;

import com.asa.HanShu2;

/**
 * 偏微分方程的数值解 
 * 多重函数
 * 其实不太想实现这个了，步骤太长了，但神经网络里面可能会用到
 * Laplace这个也用到了
 * @author Administrator
 *
 */
public class L {
	
	
	/*
	 * Poisson方程的有限差分
	 * 
	 */
	public static double[][] pianweif(double a,double b,double c,double d,int m,int n,int N,double TOL,HanShu2 f,HanShu2 g){
		
		double h = (b-a)/n;
		double k = (d-c)/m;
		double x[] = new double[n];
		double y[] = new double[m];
		double w[][] = new double[n][m];
		for (int i = 1; i < n-1; i++) {
			x[i] = a+i*h;
		}
		for (int i = 1; i < m-1; i++) {
			y[i] = c+i*k;
		}
		
		for (int i = 1; i < n-1; i++) {
			for (int j = 1; j < m-1; j++) {
				w[i][j]=0;
			}
		}
		
		double v = (h*h)/(k*k);
		double u = 2*(1+v);
		double l = 1;
		
		
		while(l<=N) {
			double z = (-h*f.hanshu(x[1], y[m-1])+g.hanshu(a, y[m-1])+v*g.hanshu(x[1], d)+v*w[1][m-1])/u;
			
			double NORM = Math.abs(z-w[1][m-1]);
			w[1][m-1] = z;
			
			
			
			
			
			
		}
		
		
		
		
		
		
		
		
		
		
		
		return null;
		
	}
	
	
	
	
	

}
